package czk.concrent.cpucache;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * 断点测试
 *
 * @Author:ChenZhangKun
 * @Date: 2022/11/17 22:04
 */

public class TestBreakPoint {
    static final List<String> list=new ArrayList<>();
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            addIfAbsent("a");
        });
        thread.start();
        addIfAbsent("a");
        thread.join();
        System.out.println(list);
    }
    public static void addIfAbsent(String content){
        if (!list.contains(content)){
            // 程序在此停住时分别选择不同的栈帧进行放行，然后会复现多线程问题
            list.add(content);
        }
    }
}
